From bb28033f75f6d564db03bef4eaeefc279d797fc1 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sat, 31 Aug 2013 00:09:51 +0000 Subject: [PATCH] add option to capture valgrind output in a log file. --- gpsbabel/vtesto | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gpsbabel/vtesto b/gpsbabel/vtesto index 72f2dbb7b..4b286817f 100755 --- a/gpsbabel/vtesto +++ b/gpsbabel/vtesto @@ -9,11 +9,20 @@ QUIET="-q" BASEPATH=`dirname $0` -while getopts "l" opt; do +while getopts "lj:" opt; do case $opt in l) OPTS="--leak-check=full --show-reachable=yes --suppressions=gpsbabel.supp" ; QUIET="";; + j) LOG=$OPTARG;; esac done shift $(($OPTIND -1)) -PNAME="valgrind $OPTS --error-exitcode=1 $QUIET ./gpsbabel" ${BASEPATH}/testo $* +if [ "x$LOG" = "x" ]; then + PNAME="valgrind $OPTS --error-exitcode=125 $QUIET ./gpsbabel" ${BASEPATH}/testo $* +else +# By default valgrind output goes to file descriptor 2, stderr. +# Some of our tests redirect file descriptor 2 to a file and compare it to an expected result. +# These compares will fail if valgrind sends output to file descriptor 2. +# This option avoids those valgrind induced miscompares by using an alternate file descriptor. + PNAME="valgrind $OPTS --error-exitcode=125 $QUIET --log-fd=3 ./gpsbabel" ${BASEPATH}/testo $* 3>$LOG +fi -- 2.30.2